package com.beijing.seventykg.po;

import java.util.Date;
import java.io.Serializable;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Table;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;

/**
 * Created by 70kg on 2017-06-28 15:12:31. 图书实体
 */
@Entity
// 声明当前类为hibernate映射到数据库中的实体类
@Table(name = "book")
// 声明在数据库中自动生成的表名为t_user
public class Book implements Serializable {
	/**
	 * 编号
	 */
	private int id;
	/**
	 * 书名
	 */
	private String title;
	/**
	 * 价格
	 */
	private double price;
	/**
	 * 出版日期
	 */
	private Date publishDate;

	public Book(int id, String title, double price, Date publishDate) {
		this.id = id;
		this.title = title;
		this.price = price;
		this.publishDate = publishDate;
	}

	public Book() {
	    
	}

	@Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "ID", unique = true, nullable = false, scale = 0)
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@Column(name = "title")
	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	@Column(name = "price")
	public double getPrice() {
		return price;
	}

	public void setPrice(double price) {
		this.price = price;
	}

	@Column(name = "publishDate")
	public Date getPublishDate() {
		return publishDate;
	}

	public void setPublishDate(Date publishDate) {
		this.publishDate = publishDate;
	}

    @Override
    public String toString() {
        return "Book [id=" + id + ", title=" + title + ", price=" + price + ", publishDate=" + publishDate + "]";
    }

}